import {createRouter, createWebHashHistory} from "vue-router";
import Login from "../views/user/login.vue";
import Home from "../views/home/index.vue";
import AllCourse from "../views/course/component/all-course.vue";
import CourseCenter from "../views/course/center.vue";
import Agreement from "../views/component/agreement.vue";
import ArticleInfo from "../views/article/info.vue";
import OrderList from "../views/user/order/list.vue";
import OrderInfo from "../views/user/order/info.vue";
import UserCenter from "../views/user/index.vue";
import StudyCenter from "../views/study/index.vue";
import StudyList from "../views/study/study-list.vue";
import StudyVideoPlay from "../views/study/video/play.vue";
import GoodsInfo from '../views/goods/info.vue'
import aboutUs from '../views/article/about-us.vue'
// import StudyRecord from  '../views/study/exercise-record.vue'
// import routes from './routes'
// 自动生成routes
//匹配路径
const pageModules = import.meta.glob("../views/**/const.js", {
  eager: true,
  // import: 'mate'
});
const compModules = import.meta.glob("../views/**/index.vue", {
  eager: true,
  import: "default",
});

const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/login",
    name: "Login",
    component: Login,
  },
  {
    path: "/course/all",
    name: "AllCourse",
    component: AllCourse,
  },
  {
    path: "/course/center",
    name: "CourseCenter",
    component: CourseCenter,
  },
  {
    path: "/agreement",
    name: "agreement",
    component: Agreement,
  },
  {
    path: "/article/info",
    name: "articleInfo",
    component: ArticleInfo,
  },
  {
    path: "/user/order/list",
    name: "orderList",
    component: OrderList,
  },
  {
    path: "/user/order/info",
    name: "orderInfo",
    component: OrderInfo,
  },
  {
    path: "/user/index",
    name: "userCenter",
    component: UserCenter,
  },
  {
    path: "/study/index",
    name: "studyCenter",
    component: StudyCenter,
  },
  {
    path: "/study/list",
    name: "StudyList",
    component: StudyList,
  },
  {
    path: "/study/StudyVideoPlay",
    name: "StudyVideoPlay",
    component: StudyVideoPlay,
  },
  {
    path: '/goods/info',
    name: 'goodsInfo',
    component: GoodsInfo
  },  {
    path: '/about-us',
    name: 'aboutUs',
    component: aboutUs
  },
  // {
  // 	path: '/study/record',
  // 	name: 'studyRecord',
  // 	component: StudyRecord
  // },
  // 其他路由配置...
];

const router = createRouter({
  history: createWebHashHistory(),
  // routes: constantRoutes,
  routes,
});
export default router;
